
# loading the remarks, etc.
TB = read.csv( "allFolks.csv", stringsAsFactors=FALSE )


names1 = do.call( paste, as.list( TB[ c("first1","last1") ]  ) )
names2 = do.call( paste, as.list( TB[ c("first2","last2") ]  ) )
#names3 = do.call( paste, as.list( TB[ c("first3","last3") ]  ) )

names2 = sub('\\s+$', '', names2, perl = TRUE)
#names3 = sub('\\s+$', '', names3, perl = TRUE)
names1 = ifelse( names2 == "", names1, paste( names1,names2, sep=" & " ) )
#names1 = ifelse( names3 == "", names1, paste( names1,names3, sep=", " ) )
TB$names = names1
#TB$names = sub('\\s+$', '', names1, perl = TRUE)

TB2 = TB[ c("personID","IDCode","pubname","names","referred","friends","remarks") ]

write.csv( TB2, file="remarks.csv", row.names=FALSE, quote=FALSE )



# tightener

nm1 = grep( "1$", names(P2) )
nm2 = grap( "2$", names(P2) )
nonEmpty = function( X ) {
	!is.na(X) & (X != "") & (X != 0)
}

for ( i in 1:seq_along(nm1) ) {
	n1 = nm1[i]
	n2 = nm2[i]
	P2[n1] = ifelse( nonEmpty(P2[n2]), paste( P2[n1], P2[n2], sep="/" ), P2[n1] )
}


